<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="bootstrap.css">
</head>
<body>
<div id="app">
    <input type="text" v-on:keyup.b="tap | debounce 2000" v-model="name">
    <!--//根据我们数组的内容进行重复-->
    <div v-for="l in list" track-by="$index">
        {{l}} <button @click="del(l)">x</button>
    </div>
</div>
<script src="vue.js"></script>
<script>
    //设置一个键盘按键 自定义b事件修饰
    Vue.directive('on').keyCodes.b= 66;
    var vm = new Vue({
        el:'#app',
        data:{
            name:'',
            list:[],
        },
        methods:{
            tap: function () {
                if(this.name){
                    this.list.push(this.name);
                }
                this.name = '';
            },
            del: function (l) {
                this.list.$remove(l);
            }
        }
    });
</script>
</body>
</html>